$(function () {
	if($("#userId").attr("uid")=="" || $("#userId").attr("uid")==undefined){
		window.location.href="login.html"
	}else{
		if($("#userId").attr("idnum")=="" || $("#userId").attr("idnum")==undefined){
			window.location.href="wsgrxx.html"
		}else{
			if(localStorage.customerNo!==""){
				
			}else{
				
			}
			
		}
	}
	
	
    getklx()
    $(".gscximg").click(function () {
    var paperType = $(".smkcp :selected").val();
    var paperNo = $(".zjhm").val();
    var userId = $("#userId").attr("uid");
        $.ajax({
            url:"front/user/userCardBind.do?cardType="+paperType+"&cardNo="+paperNo+"&userId="+userId,
            type:"POST",
            dataType:"JSON",
            success:function (json) {
                if (json.code == 0){
                	window.localStorage.customerNo = json.customerNo;
                    $(".gsztDiv1").css("display","none");
                    $(".gsztDiv2").css("display","block");
                }else {
                    alert(json.message);
                }
            }
        })

    })
})


function getklx() {
    $.ajax({
        url:"front/queryAllCardPhysicsType.do",
        type:"GET",
        dataType:"json",
        success:function (json) {
            if (json.code == 0){
                $(json.data).each(function (i,o) {
                    var option = $("<option value ='"+o.cardTypeCode+"' >"+o.cardTypeName+"</option>").appendTo(".smkcp");
                })
            }else if (json.code ==1){
                alert("市民卡类型获取错误！");
            }
        }
    })
}